package com.inputabc.ct.v1.ui.keysetting.component;

import com.inputabc.ct.v1.context.ContextParams;
import com.inputabc.ct.v1.setting.KeySetting;
import com.inputabc.ct.v1.setting.SettingContext;

import javax.swing.*;
import java.util.Map;

public class KeySettingYoudaoPanel extends JPanel {
    private JLabel appKeyLabel;
    private JTextField appKeyTextField;
    private JLabel appSecretLabel;
    private JTextField appSecretTextField;
    private Map<Object, Object> contextParam = ContextParams.contextParam;
    private KeySetting keySetting = SettingContext.keySetting;

    {
        setName(this.getClass().getName());
        appKeyLabel = new JLabel("app_key");
        appKeyTextField = new JTextField();
        appKeyTextField.setName(this.getClass().getName() + "-appKeyTextField");
        appSecretLabel = new JLabel("app_secret");
        appSecretTextField = new JTextField();
        appSecretTextField.setName(this.getClass().getName() + "-appSecretTextField");
    }

    public KeySettingYoudaoPanel() {
        add(appKeyLabel);
        add(appKeyTextField);
        add(appSecretLabel);
        add(appSecretTextField);
        String youdaoAppKey = keySetting.getYoudao().getAppKey();
        String youdaoAppSecret = keySetting.getYoudao().getAppSecret();
        appKeyTextField.setText(youdaoAppKey);
        appSecretTextField.setText(youdaoAppSecret);
    }

    public JLabel getAppKeyLabel() {
        return appKeyLabel;
    }

    public void setAppKeyLabel(JLabel appKeyLabel) {
        this.appKeyLabel = appKeyLabel;
    }

    public JTextField getAppKeyTextField() {
        return appKeyTextField;
    }

    public void setAppKeyTextField(JTextField appKeyTextField) {
        this.appKeyTextField = appKeyTextField;
    }

    public JLabel getAppSecretLabel() {
        return appSecretLabel;
    }

    public void setAppSecretLabel(JLabel appSecretLabel) {
        this.appSecretLabel = appSecretLabel;
    }

    public JTextField getAppSecretTextField() {
        return appSecretTextField;
    }

    public void setAppSecretTextField(JTextField appSecretTextField) {
        this.appSecretTextField = appSecretTextField;
    }

}
